package service.imp;

import dao.DyhReportTypeMapper;
import dao.DyhTypeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import po.*;
import service.typeService;

import java.util.List;

/**
 * Created by napianlin on 2017/4/1.
 */

@Service
public class typeServiceImpl implements typeService {

    @Autowired
    private DyhTypeMapper dyhTypeMapper;

    @Autowired
    private DyhReportTypeMapper dyhReportTypeMapper;

    /**
     * 获取 举报分类的 子分类
     *
     * @param pId
     * @return
     */
    @Override
    public List<DyhReportType> getTypeListByPId(int pId) {
        DyhReportTypeExample example = new DyhReportTypeExample();
        DyhReportTypeExample.Criteria criteria = example.createCriteria();
        criteria.andTypeEqualTo(pId);
        List<DyhReportType> list = dyhReportTypeMapper.selectByExample(example);
        return list;
    }

    @Override
/**
 * 获取 所有的父分类
 */
    public List<DyhType> getTypeList() {
        DyhTypeExample example = new DyhTypeExample();
        List<DyhType> list = dyhTypeMapper.selectByExample(example);
        return list;
    }

}
